using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;

namespace oms.Shared.Models;

/// <summary>
/// 基础实体类
/// </summary>
public abstract class BaseEntity
{
    /// <summary>
    /// 主键，使用自定义生成策略
    /// </summary>
    [Key]
    [Column(TypeName = "char(16)")]
    [Comment("主键")]
    public string Id { get; set; } = string.Empty;
    /// <summary>
    /// 创建时间
    /// </summary>
    [Column(TypeName = "datetime(3)")]
    [Comment("创建时间")]
    public DateTime CreateTime { get; set; }

    /// <summary>
    /// 创建人
    /// </summary>
    [Column(TypeName = "char(16)")]
    [Comment("创建人")]
    public required string CreateBy { get; set; }
    /// <summary>
    /// 更新时间
    /// </summary>
    [Column(TypeName = "datetime(3)")]
    [Comment("更新时间")]
    public DateTime? UpdateTime { get; set; }
    /// <summary>
    /// 更新人
    /// </summary>
    [Column(TypeName = "char(16)")]
    [Comment("更新人")]
    public string? UpdateBy { get; set; }
    /// <summary>
    /// 备注
    /// </summary>
    [Column(TypeName = "varchar(200)")]
    [Comment("备注")]
    public string? Remark { get; set; }
}